import 'package:wanxiang_app/generated/json/base/json_convert_content.dart';
import 'package:wanxiang_app/bean/user_list_entity.dart';

UserListEntity $UserListEntityFromJson(Map<String, dynamic> json) {
  final UserListEntity userListEntity = UserListEntity();
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    userListEntity.code = code;
  }
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    userListEntity.msg = msg;
  }
  final List<UserListData>? data = (json['data'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<UserListData>(e) as UserListData).toList();
  if (data != null) {
    userListEntity.data = data;
  }
  return userListEntity;
}

Map<String, dynamic> $UserListEntityToJson(UserListEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['msg'] = entity.msg;
  data['data'] = entity.data.map((v) => v.toJson()).toList();
  return data;
}

extension UserListEntityExtension on UserListEntity {
  UserListEntity copyWith({
    int? code,
    String? msg,
    List<UserListData>? data,
  }) {
    return UserListEntity()
      ..code = code ?? this.code
      ..msg = msg ?? this.msg
      ..data = data ?? this.data;
  }
}

UserListData $UserListDataFromJson(Map<String, dynamic> json) {
  final UserListData userListData = UserListData();
  final String? account = jsonConvert.convert<String>(json['account']);
  if (account != null) {
    userListData.account = account;
  }
  final String? nickname = jsonConvert.convert<String>(json['nickname']);
  if (nickname != null) {
    userListData.nickname = nickname;
  }
  final String? photo = jsonConvert.convert<String>(json['photo']);
  if (photo != null) {
    userListData.photo = photo;
  }
  return userListData;
}

Map<String, dynamic> $UserListDataToJson(UserListData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['account'] = entity.account;
  data['nickname'] = entity.nickname;
  data['photo'] = entity.photo;
  return data;
}

extension UserListDataExtension on UserListData {
  UserListData copyWith({
    String? account,
    String? nickname,
    String? photo,
  }) {
    return UserListData()
      ..account = account ?? this.account
      ..nickname = nickname ?? this.nickname
      ..photo = photo ?? this.photo;
  }
}